﻿<table class="table_body" cellpadding="0" cellspacing="0">
    <tbody>
        <tr>
            <td class="left_col" valign="top">
                <!--#Include File = "Left.asp" -->
            </td>
            <td class="middle_col" valign="top">
                <div align="center">
                    Hôm nay ngày <%Response.Write(day(Now()))%> tháng <%Response.Write(month(Now()))%> năm <%Response.Write(year(Now()))%></div>
                <div>
				<%
				'1 tin duoc goi la published khi: start <= ngay hien tai va end >=ngay hien tai va da duoc duyet publish : status=3
				Dim sSQLg
				Dim rsg				
				sSQLg = "Select top 1 c.*,ca.name as categoryname,f.filename from content as c inner join category as ca on c.categoryid = ca.id" & _
						" inner join [file] as f on f.contentid = c.id where c.isdeleted= 0 and c.hot=1 " & _
						" and c.status =3 and c.startpublish <='"& beginTime &"' and c.endpublish >='" & endTime & "'" & _
						" order by c.updatetime desc" 
				'Response.Write(sSQLg)
				set rsg = DBLayer.GetRecordSet(sSQLg)
				While not rsg.EOF 
					
				%>				
									
                    <table width="100%" border="0">
                        <tbody>
                            <tr>
                                <td>
                                    <font size="4"><b><a  href="Default.asp?act=content&id=<%Response.Write(rsg("id").Value)%>">
                                        <%Response.Write(rsg("title").Value)%></a></b></font>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <div align="justify">
                                        <div align="center">
										<%if rsg("filename").value <> "" Then%>
                                            <img src="uploads/content/<%Response.Write(rsg("filename").Value)%>" alt="" align="absMiddle"><br>
										<%end if%>
                                        </div>
                                        <font face="Times New Roman" size="3">
                                            <br>
                                            <%Response.Write(rsg("description").Value)%></font><br>
                                        <font size="3"></font>
                                    </div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
				<%
					rsg.MoveNext
				Wend
				%>
                </div>

               

                 <!--#Include File = "adv-main.asp" -->
                  
                
				<%
				Dim s1
				Dim rs1
				sSQL = "select c.* , mi.url from category as c inner join menuitem as mi on c.id = mi.categoryid where c.isdeleted =0 and mi.menuid=4"
				Set rs = DBLayer.GetRecordSet(sSQL)
				
				While Not rs.EOF
				%>
					<div class="title_home_cat">
						<a href="<%If rs("url").Value <> "" Then Response.Write(rs("url").Value) Else Response.Write("Default.asp?act=category&id=" & rs("id").Value) End If%> "><%Response.Write(rs("name").Value) %></a>
					</div>
					
					<%
					s1 = "select top 3 c.*, f.url, f.filename from content as c inner join category ca on c.categoryid = ca.id inner join [file] as f on f.contentid = c.id" & _ 
					" where c.isdeleted = 0 and c.categoryid = " & rs("id").Value & _
					" and c.status =3 and c.startpublish <='"& beginTime &"' and c.endpublish >='" & endTime & "' order by c.updatetime desc" 
					'Response.Write(s1 & "<br/>")
					set rs1 = DBLayer.GetRecordSet(s1)
					If rs1.RecordCount<> 0 Then
					
					%>
						<table class="news_box" width="100%" border="0">
							<tbody>
								<tr>
									<td>
										<b><a  href="Default.asp?act=content&id=<%Response.Write(rs1("id").Value)%>">
											<%Response.Write(rs1("title").Value)%></a></b>
									</td>
								</tr>
								<tr>
									<td style="text-align: justify;">
										<%If rs1("filename").Value <> "" Then %>
										<img src="uploads/content/<%Response.Write(rs1("filename").Value)%>" alt="" width="100" align="left" hspace="3"/>
										<%End If%>
										<%Response.Write(rs1("description").Value)%>
									</td>
								</tr>
								<%rs1.MoveNext%>
								<%While NOt rs1.EOF %>
								<tr>
									<td>
										<table>
											<tbody>
												<tr>
													<td width="7">														
														<img  src="js-css/icon_2.gif" style="border-width: 0px;" align="absmiddle"/>														
													</td>
													<td>
														<a  class="read_more" href="Default.asp?act=content&id=<%Response.Write(rs1("id").Value)%>">
															<%Response.Write(rs1("title").Value)%></a><sup class="date"><%Response.Write(rs1("updatetime").Value)%></sup>
													</td>
												</tr>
											</tbody>
										</table>
									</td>
								</tr>
								<%
								rs1.MoveNext
								Wend
								%>
							</tbody>
						</table>
						
						
							
					<%
					End If	
						
					rs.MoveNext
				Wend
				
				%>
			
            </td>
            <td class="right_col" valign="top">
                <!--#Include File = "Right.asp" -->
            </td>
        </tr>
    </tbody>
</table>
